#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <getopt.h>
#include <sys/types.h>

#define CMDLINE_LOG(format,...) printf("%s %s %d: "format"\n",__FILE__,__FUNCTION__,__LINE__,##__VA_ARGS__)

int main(int argc,char *argv[])
{
    int opt = 0;
    const char * shortOpt = "p:P:h";
    struct option longOpt[] =
    {
        {"path",required_argument,NULL,'p'},
        {"PATH",required_argument,NULL,'P'},
        {"help",no_argument,NULL,'h'},
    };

    CMDLINE_LOG("cmd line start......");

    while(-1 != (opt = getopt_long(argc,argv,shortOpt,longOpt,NULL)))
    {
        switch(opt)
        {
            case 'P':
                CMDLINE_LOG("file path is:%s", optarg);
                break;
            case 'p':
            CMDLINE_LOG("file path is:%s", optarg);
            break;
            case 'h':
            default:
                CMDLINE_LOG("unknow cmd");
                break;
        }
        
    }


    return 0;
}